package P4.T01;

public class MyStack<T>{
    private T[] datas=(T[])new Object[10];
    private int top=-1;
    public void push(T cat) throws FullStackException {
        if(top==datas.length-1)throw new FullStackException();
        else{
            datas[++top]=cat;
        }
    }

    public T pop() throws EmptyStackException {
        if(top==-1)throw new EmptyStackException();
        else {
            T data=datas[top--];
            return data;
        }
    }
}
